<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>用户列表</h2>
    </div>
    <div class="clearfix">
        <div class="col-xs-10">
        </div>

        <!-- 高级搜索 -->
        <div class="search-form  col-xs-2 text-right">
            <div class="input-group">
                <input type="text" name="sid" class="search-input form-control" value="{:I('sid')}"
                       placeholder="请输入医生ID">
                                 <span class="input-group-btn">  <a class="btn btn-default" href="javascript:;" id="search" url="{:U('agentManager')}"><i class="icon-search"></i></a></span>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table with-padding">
        <table class="table table-bordered table-striped ">
            <thead>
            <tr>
                <th class="">UID</th>
                <th class="">帐号</th>
                <th class="">姓名</th>
                <th class="">联系方式</th>
                <th>申请时间</th>
                <th>状态</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo.doctor_id}</td>
                        <td>{$vo.doctor_id|get_username}</td>
                        <td>{$vo.doctor_id|get_nickname}</td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.add_time}</td>
                        <td>
                            <switch name="vo.status">
                                <case value="1">
                                    待处理
                                </case>
                                <case value="0">
                                    已通过
                                </case>
                            </switch>
                        </td>
                        <td>
                            <eq name="vo.status" value="1">
                                <a class="btn btn-default" id="search" href="{:U('allowAgent',array('doctor_id'=>$vo['doctor_id']))}">通过申请</a>
                                <button onclick="del('{$vo.doctor_id}')">删除</button>
                                <else />
                                已经于 <span style="color: red">{$vo.allow_time|strtotime|date='Y-m-d',###}</span> 通过申请
                            </eq>
                        </td>

                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容!</td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="with-padding">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        function del(id){
            if(confirm('确定要删除吗?') ){
                location.href='{:U("delAgent")}?id='+id;
            }
        }
        //导航高亮
        highlight_subnav("{:U('User/index')}");
    </script>
</block>